#include <iostream>
using namespace std;
class Robot
{
private:
	string _name;
	int blood;
	char _type;
	int _rank;
	int sh;
	int fy;
	char _btype;
public:
	Robot()
	{
		_name = "name"; _type = 'N'; _rank = 0; _btype = 'A';
	}
	Robot(string name, char type, int rank, char btype)
	{
		_name = name; _type = type; _rank = rank; _btype = btype;
	}
	char& gettype()
	{
		return _type;
	}
	int& getblood()
	{
		return blood;
	}
	int& getsh()
	{
		return sh;
	}
	int& getfy()
	{
		return fy;
	}
	int& getrank()
	{
		return _rank;
	}
	void print()
	{
		cout << _name << "--" << _btype << "--" << _rank << "--" << blood << "--" << sh << "--" << fy << endl;
	}
};
bool judge(Robot *p, char _btype)
{
	if (p->gettype() != _btype)
	{
		if (_btype == 'N')
		{
			p->gettype() = 'N';
			p->getblood()= 5 * p->getrank();
			p->getsh() = 5 * p->getrank();
			p->getfy() = 5 * p->getrank();
		}
		else if (_btype == 'A')
		{
			p->gettype() = 'A';
			p->getblood() = 5 * p->getrank();
			p->getsh() = 10 * p->getrank();
			p->getfy() = 5 * p->getrank();
		}
		else if (_btype == 'D')
		{
			p->gettype() = 'D';
			p->getblood() = 5 * p->getrank();
			p->getsh() = 5 * p->getrank();
			p->getfy() = 10 * p->getrank();
		}
		else{
			p->getblood() = 50 * p->getrank();
			p->getsh() = 5 * p->getrank();
			p->getfy() = 5 * p->getrank();
		}
		return true;
	}
	else
	{
		return false;
	}
}
int main()
{
	int t,rank,count=0;
	char type, btype;
	string name;
	cin >> t;
	for (int i = 0; i < t; i++)
	{
		cin >> name >> type >> rank >> btype;
		Robot robot(name, type, rank, btype);
		Robot* p =&robot;
		if (judge(p, btype) == true)
		{
			count++;
		}
		robot.print();
	}
	cout<<count<<endl;
	return 0;
}
